package com.yanqu.road.server.cmd.activity.oldplayerreturn;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.OldPlayerReturnProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.oldplayerreturn.OldPlayerReturnModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：zfr
 * @date ：2022/4/18 15:06
 */
@Cmd(code = GameProtocol.S_WHITE_PLAYER_ACTIVATE, desc = "白名单激活")
public class WhitePlayerActivateCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ret = player.getModule(OldPlayerReturnModule.class).activateWhite();
    }

    @Override
    public void sendData(GamePlayer player) {
        OldPlayerReturnProto.WhitePlayerActivateRespMsg.Builder respMsg = OldPlayerReturnProto.WhitePlayerActivateRespMsg.newBuilder();
        respMsg.setRet(ret);
        player.sendPacket(ClientProtocol.U_WHITE_PLAYER_ACTIVATE, respMsg);
    }
}
